home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™ 1987-1994 / MacHack™ '93 / Papers '93 / Macintosh as Internet Server ƒ / inetd / Libraries / DaemonApp / CQueue.h < prev    next >
Encoding:
Text File  |  1993-03-19  |  1.5 KB  |  67 lines  |  [TEXT/MPS ]

  1. //---------------------------------------------------------------------
  2. //
  3. //    Copyright © 1992 David Peterson.
  4. //    All rights reserved.
  5. //
  6. //    Permission to use, copy, modify, and distribute this software for
  7. //    any purpose and without fee is hereby granted, provided that the
  8. //    above copyright notice appear in all copies and that both that
  9. //    copyright notice and this permission notice appear in supporting
  10. //    documentation.
  11. //
  12. //---------------------------------------------------------------------
  13.  
  14. #ifndef __CQUEUE__
  15. #define __CQUEUE__
  16.  
  17. #ifndef __OSUTILS__
  18. #include <OSUtils.h>
  19. #endif
  20. #ifndef __FILES__
  21. #include <Files.h>
  22. #endif
  23.  
  24. #ifdef HANDLEQUEUES
  25. class CQueue : public HandleObject {
  26. #else
  27. class CQueue {
  28. #endif
  29. public:
  30.     QHdr        fFreeQueue;            // pb available for use
  31.     QHdr        fInUseQueue;        //
  32.     QHdr        fCompletedQueue;    // should be added here in completion proc
  33.     QHdr        fProcessingQueue;    //
  34.     
  35.     int            fNumPBs;            // number we had to begin with
  36.  
  37.     int            fFree;                // number available
  38.     int            fInUse;
  39.     int            fCompleted;            // number completed
  40.     int            fProcessing;
  41.  
  42.                 CQueue();
  43.     virtual        ~CQueue();
  44.             
  45.     Boolean        AllocPBs(int howmany, int size);
  46.             
  47.     int            NumCompleted()    { return fCompleted; }
  48.  
  49.     ParmBlkPtr    GetUnusedPB();
  50.     
  51.     void        StoreCompletedPB(ParmBlkPtr pb);
  52.     ParmBlkPtr    GetCompletedPB();
  53.  
  54.     void        RecyclePB(ParmBlkPtr pb);
  55.     
  56.     ParmBlkPtr    CleanQs();
  57.     
  58. private:
  59.     ParmBlkPtr    CleanFreeQ();
  60.     ParmBlkPtr    CleanInUseQ();
  61.     ParmBlkPtr    CleanCompletedQ();
  62.     ParmBlkPtr    CleanProcessingQ();
  63.     
  64. };
  65.  
  66. #endif
  67.